home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3 / ifl / iflList.z / iflList
Encoding:
Text File  |  2002-10-03  |  10.7 KB  |  331 lines

  1.  
  2.  
  3.  
  4. iiiiffffllllLLLLiiiisssstttt((((3333))))        IIIImmmmaaaaggggeeee FFFFoooorrrrmmmmaaaatttt LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll         iiiiffffllllLLLLiiiisssstttt((((3333))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      iiiiffffllllLLLLiiiisssstttt,,,, iiiiffffllllMMMMuuuullllttttiiiiLLLLiiiisssstttt - simple doubly-linked list
  10.  
  11. IIIINNNNHHHHEEEERRRRIIIITTTTSSSS FFFFRRRROOOOMMMM
  12.      This is a base class.
  13.  
  14. HHHHEEEEAAAADDDDEEEERRRR FFFFIIIILLLLEEEE
  15.      #include <ifl/iflList.h>
  16.  
  17. CCCCLLLLAAAASSSSSSSS DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  18.      iflList provides a lightweight, fast, doubly-linked list template.
  19.  
  20.    UUUUssssiiiinnnngggg iiiiffffllllLLLLiiiisssstttt
  21.      Derive from iflListItem to place objects of type itemType in an doubly-
  22.      linked list (iflList<itemType>); for example to define a list element
  23.      that can hold an x,y int pair you would write:
  24.  
  25.               class XY : public iflListItem {
  26.               public:
  27.                   XY(int X, int Y) { x = X; y = Y; }
  28.                   int x, y;
  29.               };
  30.  
  31.  
  32.      You could then use it with code like:
  33.  
  34.               XY foo(3,4);
  35.               iflList<XY> list;
  36.               list.append(&foo);
  37.               ...
  38.               iflListIter<XY> iter(list);
  39.               XY* item;
  40.               while (item = iter.next()) item->unlink();
  41.  
  42.  
  43.      If you need to place an object in two lists simulaneously you would write
  44.      something like:
  45.  
  46.               class XY;
  47.               class A : public iflListItem {};
  48.               class B : public iflListItem {};
  49.  
  50.               class XY : public A, public B {
  51.               public:
  52.                   XY(int X, int Y) { x = X; y = Y; }
  53.                   int x, y;
  54.               };
  55.  
  56.  
  57.      and to operate on the "A" list of the XY elements:
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. iiiiffffllllLLLLiiiisssstttt((((3333))))        IIIImmmmaaaaggggeeee FFFFoooorrrrmmmmaaaatttt LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll         iiiiffffllllLLLLiiiisssstttt((((3333))))
  71.  
  72.  
  73.  
  74.               XY foo(3,4);
  75.               iflMutliList<XY,A> list;
  76.               list.append(&foo);
  77.               ...
  78.               iflMultiListIter<XY,A> iter(list);
  79.               XY* xy;
  80.               while (item = iter.next()) item->unlink();
  81.  
  82.  
  83. CCCCLLLLAAAASSSSSSSS MMMMEEEEMMMMBBBBEEEERRRR FFFFUUUUNNNNCCCCTTTTIIIIOOOONNNN SSSSUUUUMMMMMMMMAAAARRRRYYYY
  84.    CCCCoooonnnnssssttttrrrruuuuccccttttoooorrrrssss
  85.           iflList<type>()
  86.           iflMultiList<itemType,linkageType>()
  87.  
  88.  
  89.    EEEEddddiiiittttiiiinnnngggg
  90.           void append(linkageType* item)
  91.           void appendList(iflMultiList<itemType,linkageType>* list)
  92.           void appendSubList(linkageType* bgn, linkageType* end)
  93.           void clear()
  94.           void insert(linkageType* item)
  95.           void insertAfter(linkageType* item, linkageType* after)
  96.           void insertBefore(linkageType* item, linkageType* before)
  97.           void insertList(iflMultiList<itemType,linkageType>* list)
  98.           void insertSubList(linkageType* bgn, linkageType* end)
  99.           void unlink(linkageType* item)
  100.  
  101.  
  102.    QQQQuuuueeeerrrryyyy
  103.           int isEmpty() const
  104.           itemType* head() const
  105.           itemType* tail() const
  106.           itemType* getNext(const linkageType* item) const
  107.           itemType* getPrev(const linkageType* item) const
  108.  
  109.  
  110. FFFFUUUUNNNNCCCCTTTTIIIIOOOONNNN DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNNSSSS
  111.      iiiiffffllllLLLLiiiisssstttt(((())))
  112.  
  113.           iflList<itemType>()
  114.  
  115.  
  116.           Creates an iflMultiList of length zero (that is, empty list).  The
  117.           items will be of type _i_t_e_m_T_y_p_e. Access to the next and prev pointers
  118.           will also be through itemType.  Use this form of the constructor
  119.           with items that will be placed on only one type of list.
  120.  
  121.      iiiiffffllllMMMMuuuullllttttiiiiLLLLiiiisssstttt(((())))
  122.  
  123.           iflMultiList<itemType,linkageType>()
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. iiiiffffllllLLLLiiiisssstttt((((3333))))        IIIImmmmaaaaggggeeee FFFFoooorrrrmmmmaaaatttt LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll         iiiiffffllllLLLLiiiisssstttt((((3333))))
  137.  
  138.  
  139.  
  140.           Creates an iflMultiList of length zero (that is, empty list).  The
  141.           items will be of type _i_t_e_m_T_y_p_e. Access to the next and prev pointers
  142.           will be done through casts to type _l_i_n_k_a_g_e_T_y_p_e. This form of the
  143.           contructor is useful when used with items that will be placed on
  144.           more than one type of list.
  145.  
  146.      aaaappppppppeeeennnndddd(((())))
  147.  
  148.           void append(linkageType* item)
  149.  
  150.  
  151.           Appends _i_t_e_m to the end of the list.
  152.  
  153.      aaaappppppppeeeennnnddddLLLLiiiisssstttt(((())))
  154.  
  155.           void appendList(iflMultiList<itemType,linkageType>* list)
  156.  
  157.  
  158.           Removes all of the items from _l_i_s_t and appends them to the end of
  159.           this list (in the same order that they were on the original list).
  160.  
  161.      aaaappppppppeeeennnnddddSSSSuuuubbbbLLLLiiiisssstttt(((())))
  162.  
  163.           void appendSubList(linkageType* bgn, linkageType* end)
  164.  
  165.  
  166.           Removes all of the items between _b_g_n and _e_n_d, inclusive, from
  167.           whatever list they are on and appends them to the end of this list
  168.           (in the same order that they were on the original list).
  169.  
  170.      cccclllleeeeaaaarrrr(((())))
  171.  
  172.           void clear()
  173.  
  174.  
  175.           Clears the list of all items. This is not usually a good idea, but
  176.           is sometimes necessary to avoid an assertion failure on destruction.
  177.  
  178.      ggggeeeettttNNNNeeeexxxxtttt(((())))
  179.  
  180.           itemType* getNext(const linkageType* item) const
  181.  
  182.  
  183.           Returns the item immediately following _i_t_e_m or NULL if _i_t_e_m is at
  184.           the end of the list.
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. iiiiffffllllLLLLiiiisssstttt((((3333))))        IIIImmmmaaaaggggeeee FFFFoooorrrrmmmmaaaatttt LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll         iiiiffffllllLLLLiiiisssstttt((((3333))))
  203.  
  204.  
  205.  
  206.      ggggeeeettttPPPPrrrreeeevvvv(((())))
  207.  
  208.           itemType* getPrev(const linkageType* item) const
  209.  
  210.  
  211.           Returns the item immediately preceding _i_t_e_m or NULL if _i_t_e_m is at
  212.           the beginning of the list.
  213.  
  214.      hhhheeeeaaaadddd(((())))
  215.  
  216.           itemType* head() const
  217.  
  218.  
  219.           Returns the item at the head of the list or NULL if the list is
  220.           empty.
  221.  
  222.      iiiinnnnsssseeeerrrrtttt(((())))
  223.  
  224.           void insert(linkageType* item)
  225.  
  226.  
  227.           Inserts _i_t_e_m at the front of the list.
  228.  
  229.      iiiinnnnsssseeeerrrrttttAAAAfffftttteeeerrrr(((())))
  230.  
  231.           void insertAfter(linkageType* item, linkageType* after)
  232.  
  233.  
  234.           Inserts _i_t_e_m immediately following the item indicated by _a_f_t_e_r.
  235.  
  236.      iiiinnnnsssseeeerrrrttttBBBBeeeeffffoooorrrreeee(((())))
  237.  
  238.           void insertBefore(linkageType* item, linkageType* before)
  239.  
  240.  
  241.           Inserts _i_t_e_m immediately preceding the item indicated by _b_e_f_o_r_e.
  242.  
  243.      iiiinnnnsssseeeerrrrttttLLLLiiiisssstttt(((())))
  244.  
  245.           void insertList(iflMultiList<itemType,linkageType>* list)
  246.  
  247.  
  248.           Removes all of the items from _l_i_s_t and prepends them to the front of
  249.           this list (in the same order that they were on the original list).
  250.  
  251.      iiiinnnnsssseeeerrrrttttSSSSuuuubbbbLLLLiiiisssstttt(((())))
  252.  
  253.           void insertSubList(linkageType* bgn, linkageType* end)
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.                                                                         PPPPaaaaggggeeee 4444
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. iiiiffffllllLLLLiiiisssstttt((((3333))))        IIIImmmmaaaaggggeeee FFFFoooorrrrmmmmaaaatttt LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll         iiiiffffllllLLLLiiiisssstttt((((3333))))
  269.  
  270.  
  271.  
  272.           Removes all of the items between _b_g_n and _e_n_d, inclusive, from
  273.           whatever list they are on and prepends them to the front of this
  274.           list (in the same order that they were on the original list).
  275.  
  276.      iiiissssEEEEmmmmppppttttyyyy(((())))
  277.  
  278.           int isEmpty() const
  279.  
  280.  
  281.           Returns TRUE if the list is empty, FALSE otherwise.
  282.  
  283.      ttttaaaaiiiillll(((())))
  284.  
  285.           itemType* tail() const
  286.  
  287.  
  288.           Returns the item at the tail of the list or NULL if the list is
  289.           empty.
  290.  
  291.      uuuunnnnlllliiiinnnnkkkk(((())))
  292.  
  293.           void unlink(linkageType* item)
  294.  
  295.  
  296.           Unlinks the _i_t_e_m from the list.  If _i_t_e_m is not on the list, the
  297.           result is undefined.
  298.  
  299. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  300.      iflListItem, iflListIter, iflListIterRev
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.                                                                         PPPPaaaaggggeeee 5555
  328.  
  329.  
  330.  
  331.